#!/bin/sh
#BK dummy for now
#v407 install firmware tarball if not installed.
#100228 BK
#101204 BK changes below, modified firmware tarball.
#111112 Karl Godt: fix for firmware not tarball.
#120202 rodin.s: i18n
#120202 jwm -reload

export TEXTDOMAIN=pgprs-shell
export OUTPUT_CHARSET=UTF-8

[ "`which pgprs-setup`" != "" ] && exec pgprs-setup

#111112 Karl Godt: fix for firmware not tarball...
if [ -f /lib/modules/all-firmware/pgprs.tar.gz ]; then
 cp -f /lib/modules/all-firmware/pgprs.tar.gz /tmp/
 cd /tmp
 tar -zxf pgprs.tar.gz
 cp -a -f --remove-destination /tmp/pgprs/* /
 sync
 cd /
fi
if [ -d /lib/modules/all-firmware/pgprs ]; then
 cp -a -f --remove-destination /lib/modules/all-firmware/pgprs/* /
fi

#101204... 120202 jwm has -reload ...
yaf-splash -bg violet -placement center -timeout 3 -text "$(gettext 'Updating menu...')"
/usr/sbin/fixmenus
if [ "`pidof jwm`" != "" ];then
 JWMVER=`jwm -v|head -n1|cut -d ' ' -f2|cut -d - -f2`
 if vercmp $JWMVER lt 574;then
  jwm -restart #update the menu.
 else
  jwm -reload
 fi
fi
sleep 1

#note, pgprs-setup and pgprs-connect are in the firmware tarball.
exec pgprs-setup
